package GSEA::Pvalue::Chrono;

use strict ;
use warnings;
 

sub constrChrono($) #constructor
{
	my ($classe ) = @_; 
	
	my @startTime = localtime(time);
	
	my $this = {
					"startTime"		=> \ @startTime	
				};
	
	bless ($this,$classe);  
		
	return $this;  
}


sub tick($)
{
	( my $this ) = @_ ;
	
	my @startTime = @{ $this->{"startTime"} };
	
	my @endTime = localtime(time);
	$this->{"startTime"}  = \ @endTime ;
	
	my $a = 60 - $startTime[0] ;
	my $b = $endTime[0] ;
	my $min = $endTime[1] - $startTime[1] ;if($a != 0 ){$min--;}
	my $sec = $a + $b + $min*60 ;
	$min = int( $sec / 60 ) ;
	$sec = $sec - ( 60 * $min );
	
	return("$min mins $sec secondes");
}

sub tickSec($)
{
	( my $this ) = @_ ;
	
	my @startTime = @{ $this->{"startTime"} };
	
	my @endTime = localtime(time);
	$this->{"startTime"}  = \ @endTime ;
	
	my $a = 60 - $startTime[0] ;
	my $b = $endTime[0] ;
	my $min = $endTime[1] - $startTime[1] ;if($a != 0 ){$min--;}
	my $sec = $a + $b + $min*60 ;
	
	return($sec);
}


1;